<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>捉标题</title>
	<script>

		window.onload = function () {

			title = document.getElementById('title');

			arr= ['red','blue','yellow','green']

			function color() {

				index = Math.round(Math.random()*(arr.length-1));


				title.style.background = arr[index];
			}

			setInterval(color,100);

			console.log(title);
		}
	</script>
</head>
<body>
	<p class="item">我是p</p>
	<p class="item">我是p</p>
	<span id='title'>我是span</span>
	<i>我是i</i>
	<div id="box">
		<b>我是b</b>
	</div>
</body>
</html>